
x=1
nummax=eval(input())

count=1
while x>0:
    num=eval(input())
    if num==0:
        break
    if num>nummax:
        nummax=num
        count=1
    elif num==nummax:
        count+=1
    else:
        pass
print(nummax) 
print(count)